<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['user'])){
	echo "timeout";
}else{
include '../operations/connection.php';	
$idcomment = $_REQUEST['idcomment'];
$idtestproject = $_REQUEST['idtestpro'];
$id_employee = $_REQUEST['idemp'];
if ($_REQUEST['newlang'] == "EN") {
			include "../value/value_en.php";
		}else if($_REQUEST['newlang'] == "VN") {
			include "../value/value_vn.php";
		}
		else {
			include "../value/value_kr.php";
		}

		
$sqldeletecomment = "DELETE FROM pr_cause WHERE pr_cause.IDComment = '$idcomment'";
mysql_query($sqldeletecomment);

$querycause = mysql_query("select c.IDComment,c.IDTestProject,c.IDEmployee,c.Comment,c.DateComment,
								 e.IDEmployee,e.FullName,c.IDTestProject from pr_cause c, employee e 
									 where c.IDEmployee = e.IDEmployee and c.IDTestProject = '$idtestproject' ORDER BY  c.DateComment ASC;");
if (mysql_num_rows($querycause)>0){
	//<?php if (mysql_num_rows($querycause)==0){ echo 'display: none';}

						                        
						                        while ($rowcoment = mysql_fetch_array($querycause)){
						                        		$idcomment = $rowcoment['IDComment'];
						                        		$idemployeecomment = $rowcoment['IDEmployee'];
														$stringcolor1 = substr($rowcoment['Comment'],0,-14);
														?>
												<div style="border-bottom: 1px solid #C4C0C9;border-right: 1px solid #C4C0C9;">
							                        	<span style="font-size: 13px; color: #424242;"> <?php if (strlen($stringcolor1)==0){echo " $l_cause : ".$rowcoment['Comment'];}else{echo "$l_cause : ".$stringcolor1;}?></span> 
							                        	<i style="color:#424242; display:block; text-align:right;padding-right:60px; font-size: 13px;"><?php echo $rowcoment['FullName']." (".$rowcoment['DateComment'].")"?></i>
							                        	<?php if($idemployeecomment==$id_employee || $_SESSION['posmanager']==1){?>
							 							<span  style="color:#236DA4;cursor: pointer;float: right;margin-top: -25px;" onclick="if(confirm('<?php echo $l_confirm_deleteproject?>')){ delete_cause('<?=$idcomment?>','<?=$idtestproject?>','<?=$id_employee?>',this);return true}else{return false}">[ <?=$l_delete?> ]</span>
							 							<?php }?>
						                         </div>
					                  	 <?php }?>
	               <?php 
}
mysql_close($connection);
	                        }?>